package com.hyfrogx.modules.push.config;

import cn.hutool.core.util.ObjectUtil;
import com.hyfrogx.common.exception.MyException;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;
import java.util.*;

@Configuration
@Data
public class UmConfig {

    @Value("${um-push.appKey}")
    private String appKey;
    @Value("${um-push.appMasterSecret}")
    private String appMasterSecret;
    @Value("${um-push.appKeyIOS}")
    private String appKeyIOS;
    @Value("${um-push.appMasterSecretIOS}")
    private String appMasterSecretIOS;
    @Value("${um-push.productionMode}")
    private boolean productionMode;

    public static String AppKey="";
    public static String AppMasterSecret="";
    public static String AppKeyIOS="";
    public static String AppMasterSecretIOS="";
    public static boolean ProductionMode=false;

    public static String host = "http://msg.umeng.com";
    public static String sendApiPath = "http://msg.umeng.com/api/send";
    public static String uploadApiPath = "http://msg.umeng.com/upload";

    public enum Sys{
        Android,
        IOS
    }
    public enum CasetType {
        unicast,//单播
        listcast,//列播，要求不超过500个device_token
        filecast,//文件播，多个device_token可通过文件形式批量发送
        broadcast,//广播
        groupcast, //组播，按照filter筛选用户群, 请参照filter参数
        customizedcast//通过alias进行推送，包括以下两种case: - alias: 对单个或者多个alias进行推送  - file_id: 将alias存放到文件后，根据file_id来推送
    }
    public enum AfterOpenAction {
        go_app, // 打开应用
        go_custom,// 用户自定义内容。
        go_url, // 跳转到URL
        go_activity, // 打开特定的activity
    }

    public enum DisplayType{
        notification,///通知:消息送达到用户设备后，由友盟SDK接管处理并在通知栏上显示通知内容。
        message//消息:消息送达到用户设备后，消息内容透传给应用自身进行解析处理。
    }

    public enum CustomAfterOpenAction {
        go_channel,//直播
        go_information,//资讯
        go_zoom,//会议
        go_video,//点播影视
        go_column_lesson,//栏目-课程
        go_vr,//vr
        go_activity,//活动页面
        go_radio,//电台
        go_small_video,//小视频
        go_exit_app,//退出app
        go_meet_end,//会议即将结束
        go_eachSend,//蛙豆赠送
        go_course,//课程
        go_Recharge,//充值
        go_coin,//积分推送
    }

    @PostConstruct
    public void init(){
        UmConfig.AppKey= this.appKey;
        UmConfig.AppMasterSecret= this.appMasterSecret;
        UmConfig.AppKeyIOS= this.appKeyIOS;
        UmConfig.AppMasterSecretIOS= this.appMasterSecretIOS;
        UmConfig.ProductionMode= this.productionMode;
    }

    public static final HashSet<String> ROOT_KEYS = new HashSet<String>(Arrays.asList(new String[]{
            "appkey", "timestamp", "type", "device_tokens", "alias", "alias_type", "file_id",
            "filter","payload", "production_mode", "policy", "description","mipush","mi_activity"}));
}
